/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.server.handler.user;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.lucava.boatskeeper.server.MockUserDao;
import org.lucava.boatskeeper.shared.rpc.user.SaveUser;
import org.lucava.boatskeeper.shared.rpc.user.SaveUserResult;

/**
 *
 * @author glenn
 */
public class SaveUserHandler implements ActionHandler<SaveUser, SaveUserResult> {

    @Override
    public Class<SaveUser> getActionType() {
        return SaveUser.class;
    }

    @Override
    public SaveUserResult execute(SaveUser a, ExecutionContext ec) throws ActionException {

        MockUserDao.save(a.getData());

        SaveUserResult saveBoatResult = new SaveUserResult(a.getData());

        return saveBoatResult;
    }

    @Override
    public void rollback(SaveUser a, SaveUserResult r, ExecutionContext ec) throws ActionException {
    }
}
